---
layout: m1x_soap
title: Product Link Assign
---

<h2><a name="catalog_product_link.assign-Module%3AMageCatalog"></a>Module: Mage_Catalog</h2>


<h4><a name="catalog_product_link.assign-Resource%3Acatalogproductlink"></a>Resource: catalog_product_link</h4>

<p><b>Aliases:</b></p>
<ul>
	<li>product_link</li>
</ul>


<h5><a name="catalog_product_link.assign-Method%3A"></a>Method:</h5>

<ul>
	<li>catalog_product_link.assign (SOAP V1)</li>
	<li>catalogProductLinkAssign (SOAP V2)</li>
</ul>


<p>Allows you to assign a product link (cross_sell, grouped, related, or up_sell) to another product.</p>

<p><b>Aliases:</b></p>
<ul>
	<li>product_link.assign</li>
</ul>



<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> type <br class="atl-forced-newline" /> </td>
<td> Type of the link (cross_sell, grouped, related, or up_sell) </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> product\productId <br class="atl-forced-newline" /> </td>
<td> Product ID or SKU </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> linkedProduct\linkedProductId <br class="atl-forced-newline" /> </td>
<td> Product ID or SKU for the link </td>
</tr>
<tr>
<td> array </td>
<td> data <br class="atl-forced-newline" /> </td>
<td> Array of catalogProductLinkEntity </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> identifierType <br class="atl-forced-newline" /> </td>
<td> Defines whether the product ID or SKU is passed in the 'product' parameter </td>
</tr>
</tbody></table>


<p><b>Returns</b>:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Description </th>
</tr>
<tr>
<td> boolean </td>
<td> True if the link is assigned to the product </td>
</tr>
</tbody></table>


<p>The <b>catalogProductLinkEntity</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> product_id <br class="atl-forced-newline" /> </td>
<td> Product ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> type <br class="atl-forced-newline" /> </td>
<td> Type of the link (cross_sell, grouped, related, or up_sell) </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> set <br class="atl-forced-newline" /> </td>
<td> Product attribute set </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> sku <br class="atl-forced-newline" /> </td>
<td> Product SKU </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> position <br class="atl-forced-newline" /> </td>
<td> Position of the product </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> qty <br class="atl-forced-newline" /> </td>
<td> Quantity of products </td>
</tr>
</tbody></table>


<h4><a name="catalog_product_link.assign-Examples"></a>Examples</h4>

<h5><a name="catalog_product_link.assign-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client-&gt;login('apiUser', 'apikey');

$result = $client-&gt;call($session, 'catalog_product_link.assign', array('type' =&gt; 'related', 'product' =&gt; '1', 'linkedProduct' =&gt; '4'));
var_dump ($result);

// If you don't need the session anymore
//$client-&gt;endSession($session);</pre>
		</div>
</div></div>

<h5><a name="catalog_product_link.assign-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy-&gt;login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy-&gt;catalogProductLinkAssign($sessionId, 'related', '1', '4');
var_dump($result);</pre>
		</div>
</div></div>


<h5><a name="catalog_product_link.assign-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div>
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey'));

$result = $proxy-&gt;catalogProductLinkAssign((object)array('sessionId' =&gt; $sessionId-&gt;result, 'type' =&gt; 'related', 'productId' =&gt; '1', 'linkedProductId' =&gt; '4'));

var_dump($result-&gt;result);</pre>
		</div>
</div></div>


